package com.mm;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
//将服务注册到注册管理中心
@EnableDiscoveryClient
@ServletComponentScan //使用该注解后,Servlet、Filter、Listener可直接通过@WebServlet、@WebFilter、@WebListener注解自动注册
public class MmSpringBootApplication {
    public static void main(String[] args) {
        SpringApplication.run(MmSpringBootApplication.class, args);
    }
    @Bean
    @LoadBalanced
        //开启客户端负载均衡
    RestTemplate restTemplate(){
        return new RestTemplate();
    }
}